//
//  YKClientDataReadOnlyView.m
//  YunKang
//
//  Created by leoking870 on 2017/11/30.
//  Copyright © 2017年 leoking870. All rights reserved.
//

#import "YKClientDataReadOnlyView.h"
#import "YKClientDataDetail.h"
#import "YKInputView.h"

@interface YKClientDataReadOnlyView ()
@property (nonatomic, strong) YKClientDataDetail* dataDetail;
@end


@implementation YKClientDataReadOnlyView

- (instancetype)initWithClientModel:(YKClientDataDetail *)dataDetail
{
    self = [super initWithFrame:CGRectZero];
    if (self) {
        _dataDetail = dataDetail;
        YKInputView* drugCodeView = [[YKInputView alloc]initWithTitle:@"客户编码" input:self.dataDetail.C_CODE];

        [self addSubview:drugCodeView];

        YKInputView* clientNameView = [[YKInputView alloc]initWithTitle:@"客户名称" input:self.dataDetail.C_NAME];
        [self addSubview:clientNameView];

        YKInputView* lawPeopleView = [[YKInputView alloc]initWithTitle:@"企业法人" input:self.dataDetail.FRDB];
        [self addSubview:lawPeopleView];

        YKInputView* detailAddressTF = [[YKInputView alloc]initWithTitle:@"收货地址" input:self.dataDetail.RECEIVING_DETAILADDRESS];
        [self addSubview:detailAddressTF];

        YKInputView* yinshouMoneyView = [[YKInputView alloc]initWithTitle:@"累积订单" input:self.dataDetail.LJDD_SUM];
        [self addSubview:yinshouMoneyView];

        YKInputView* yishouMoneyView = [[YKInputView alloc]initWithTitle:@"累积收款" input:self.dataDetail.LJSK_SUM];
        [self addSubview:yishouMoneyView];

        YKInputView* userNameView = [[YKInputView alloc]initWithTitle:@"业务人员" input:self.dataDetail.USER_NAME];
        [self addSubview:userNameView];

        for (YKInputView *view in self.subviews) {
            view.inputBackgroundColor = [UIColor tf_colorWithHexString:@"#f2f2f2"];
            view.contentTopInset = 0;
        }

        [self.subviews mas_makeConstraints:^(MASConstraintMaker *make) {
            make.leading.trailing.equalTo(self);
            make.width.mas_equalTo(self.mas_width);
        }];
        [self.subviews mas_alignAlongAxis:MASAxisTypeVertical fixedSpace:@4 leadSpace:8 tailSpace:8];
    }
    return self;
}


@end
